import requests
from requests import Response
import time
class Test1:

    def get(self):
        print('执行了get方法')
    
    def delete(self):
        print('执行了delete方法')



t = Test1()

print(getattr(t,'get'))
getattr(t,'get')()


token = 111
header = {
    'Authorization': f'Bearer {token}'
}
'''

requests.get('url',headers=header)

'''
rs = requests.get('http://127.0.0.1:8082/get',headers=header)
# print(rs.text)


dict1 = {
    'sessionid': 'xxxxxxx'
}
def printTime(r:Response,*args,**kwargs):
    print(f'返回的响应内容是：\n{r.text}')
    print(time.time())

rs = requests.get('http://127.0.0.1:8082/get',cookies=dict1,hooks={'response':[printTime]})


# s = requests.Session()
# s.request() # 这个会把请求发出去并返回response
# requests.Request() # 这个返回的是request对象
